package com.hdjk.view.callback;

import com.lst.projectlib.entity.Msg;

import org.json.JSONArray;
import org.json.JSONObject;

import okhttp3.Response;

/**
 * Created by sxy on 2017/11/2.
 */

public abstract class FavoriteListCallBack extends MsgCallBack {
    @Override
    public Msg parseNetworkResponse(Response response, int i) throws Exception {
        Msg msg = super.parseNetworkResponse(response, i);
        JSONArray array = (JSONArray) msg.getData();
        if (array != null) {
            String s = "";
            for (int j = 0; j < array.length(); j++) {
                JSONObject object = array.getJSONObject(j);
                if (!object.isNull("FundCode")) {
                    s = s + object.getString("FundCode") + (j < (array.length() - 1) ? "," : "");
                }
            }
            msg.setData(s);
        }
        return msg;
    }
}
